~ chicken-core (master) /manual/Module (scheme inexact)
Trap1[[tags: manual]]2[[toc:]]34== Module (scheme inexact)56The R7RS (scheme inexact) library exports procedures which7are typically only useful with inexact values.89<procedure>(exp z)</procedure><br>10<procedure>(log z [z2])</procedure><br>11<procedure>(sin z)</procedure><br>12<procedure>(cos z)</procedure><br>13<procedure>(tan z)</procedure><br>14<procedure>(asin z)</procedure><br>15<procedure>(acos z)</procedure><br>16<procedure>(atan x [y])</procedure>1718These procedures compute the usual transcendental functions. The log procedure19computes the natural logarithm of z (not the base ten logarithm) if a single argument is given, or the base-z2 logarithm of20z if two arguments are given. The asin, acos, and atan procedures compute21arcsine (sin^−1), arc-cosine (cos^−1), and arctangent (tan^−1),22respectively. The two-argument variant of atan computes {{(angle (make-rectangular x y))}}23 (see below), even in implementations that don’t support complex numbers.2425In general, the mathematical functions log, arcsine, arc-cosine, and arctangent26are multiply defined. The value of log z is defined to be the one whose27imaginary part lies in the range from −π (inclusive if -0.0 is distinguished,28exclusive otherwise) to π (inclusive). The value of log 0 is mathematically29undefined. With log defined this way, the values of sin^−1 z, cos^−1 z, and30tan^−1 z are according to the following formulæ:3132 sin^−1 z = −i * log (i * z + (1 − z^2)^1/2)3334 cos^−1 z = π/2 − sin^−1 z3536 tan^−1 z = (log (1 + i * z) − log (1 − i * z)) / (2 * i)3738However, (log 0.0) returns -inf.0 (and (log -0.0) returns -inf.0+π*i) if the39implementation supports infinities (and -0.0).4041The range of (atan x y) is as in the following table. The asterisk (*) indicates that the entry42applies to implementations that distinguish minus zero.4344 y condition x condition range of result r45 y = 0.0 x > 0.0 0.046 ∗ y = + 0.0 x > 0.0 + 0.047 ∗ y = −0.0 x > 0.0 −0.048 y > 0.0 x > 0.0 0.0 < r < π/249 y > 0.0 x = 0.0 π/250 y > 0.0 x < 0.0 π/2 < r < π51 y = 0.0 x < 0 π52 ∗ y = + 0.0 x < 0.0 π53 ∗ y = −0.0 x < 0.0 −π54 y < 0.0 x < 0.0 −π< r< −π/255 y < 0.0 x = 0.0 −π/256 y < 0.0 x > 0.0 −π/2 < r< 0.057 y = 0.0 x = 0.0 undefined58 ∗ y = + 0.0 x = + 0.0 + 0.059 ∗ y = −0.0 x = + 0.0 −0.060 ∗ y = + 0.0 x = −0.0 π61 ∗ y = −0.0 x = −0.0 −π62 ∗ y = + 0.0 x = 0 π/263 ∗ y = −0.0 x = 0 −π/26465When it is possible, these procedures66produce a real result from a real argument.6768---69Previous: [[Module (scheme eval)]]7071Next: [[Module (scheme lazy)]]